package com.twt.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.twt.recruit.entity.Answer;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AnswerMapper extends BaseMapper<Answer> {

    @Select("select * from answer where question_id = #{questionId} and uid = #{uid} limit 1")
    Answer answerIdByQuestionIdAndUid(String uid, Integer questionId);

    @Select("select * from answer where project_id = #{projectId}")
    List<Answer> getAnswerByProjectId(Integer projectId);

    @Delete("delete from answer where project_id = #{projectId}")
    void delAnswerByProjectId(Integer projectId);

    void delAnswerOptionByAnswerId(List<Integer> answerIdList);
}
